﻿@model ecommerce2011.Models.Product

@helper Total(Decimal espectaculo, Decimal ciudad, Decimal transporte, Decimal hospedaje)
    {
        if (transporte == null)
        {
            transporte = 0;
        }
        if (hospedaje == null)
        {
            hospedaje = 0;
        }
        @((espectaculo + ciudad + hospedaje + transporte).ToString())
        
}
@{
    ViewBag.Title = "Detalles";
}

@{
var total = (Decimal)ViewData["Total"];
}

@{
    var topCinco = (List<ecommerce2011.Models.Product>)ViewData["topCinco"];
}
<h2>Detalle del Producto</h2>

<fieldset>
    <legend>@Html.DisplayFor(model => model.Name)</legend>
    <div class="display-field">
        <img alt="@Html.DisplayFor(model => model.Name)" src="@Url.Content("ftp://localhost/")@Html.DisplayFor(model => model.Image)" />
        
    </div><br />

    <div class="display-label">Espectáculo</div>
    <div class="display-field">
        @Html.DisplayFor(model => model.Show)
    </div>
    <br />
    <div class="display-label">Fecha del Espectáculo</div>
    <div class="display-field">
        @Html.DisplayFor(model => model.ShowDate)
    </div>
    <br />
    <div class="display-label">Ciudad del Espectáculo</div>
    <div class="display-field">
        @Html.DisplayFor(model => model.City.Name)
    </div>
    <br />
    <div class="display-label">Fecha de Llegada</div>
    <div class="display-field">
        @Html.DisplayFor(model => model.ArrivalDate)
    </div>
    <br />
    <div class="display-label">Fecha de Salida</div>
    <div class="display-field">
        @Html.DisplayFor(model => model.DepartureDate)
    </div>
    <br />
    <div class="display-label">Tarifa de Transporte</div>
    <div class="display-field">
        @Html.DisplayFor(model => model.TransportationRate.NameRate) - $@Html.DisplayFor(model => model.TransportationRate.Price)
    </div>
    <br />
    <div class="display-label">Tarifa de Espectáculo</div>
    <div class="display-field">
        @Html.DisplayFor(model => model.ShowRate.NameRate) - $@Html.DisplayFor(model => model.ShowRate.Price)
    </div>
    <br />
    <div class="display-label">Tarifa de Hospedaje</div>
    <div class="display-field">
        @Html.DisplayFor(model => model.AccommodationRate.NameRate) - $@Html.DisplayFor(model => model.AccommodationRate.Price)
    </div>
    <br />
    <div class="display-label">PRECIO TOTAL</div>
    <div class="display-field">
        $@total
    </div>
</fieldset>
<form action="/Product/AddCart/" method="post">
<input id="productId" name="productId" type="hidden" value="@Model.ProductId" />
Agregar <input id="quantity" name="quantity" type="text" value="1" /> al carrito.       <input type="submit" value="Agregar" />
</form>
<br /><br />
<p>
    @Html.ActionLink("Volver a búsqueda", "Index")
</p>
<fieldset>
    @if ( topCinco != null && topCinco.Count() > 0){
        <legend>Estos son los @topCinco.Count.ToString() productos que han acompañado ordenes</legend>
        
        foreach (var top in topCinco){
            <div class="display-field">
                <img alt="@top.Name" src="@Url.Content("ftp://localhost/mini/")@top.Image" /><br />
            @top.Name<br />
            @Html.ActionLink("Ver Detalle", "Details", new { id = top.ProductId })
            </div>
        }
    }
</fieldset>